if ((n=myaddress.net) & (f=myaddress.node)) then asname=UPPER(d2x(65536+myaddress.net-myaddress.pointnet,4)||d2x(65536+myaddress.node-p,4)||right(arcmailname,4))
if ((tonode.idx.node=myaddress.node) & (tonode.idx.net=myaddress.net)) then asname=UPPER(d2x(65536+myaddress.net-myaddress.pointnet,4)||d2x(65536+myaddress.node-tonode.idx.point,4)||right(arcmailname,4))
if LastPos('/',arg(1))~=0 then return SubStr(arg(1),LastPos('/',arg(1))+1)
else if LastPos(':',arg(1))~=0 then return SubStr(arg(1),LastPos(':',arg(1))+1)
else return arg(1)
/**/
get_packetname:
tspec=left(date(),2)||compress(time(),":")
if (tspec=packet_spec) then tspec=tspec+1
do while exists(OUTDIR||tspec".PKT")
tspec=tspec+1
end
if ~open('out',pktspec,'W') then call PutLog("Can't write new packet_spec file",10,10)
else DO
writeln('out',tspec)
close('out')
END
return(tspec".PKT")
makedirs:
do i=1 to arg()
call makedir(left(arg(i),length(arg(i))-1))
end
return
readcfg:
if open('in',pktspec,'R') then do
packet_spec=readln('in')
close('in')
end
PutLog('Reading 'xpackcfg,60,10)
if ~Open('cfgfile',xpackcfg,'R') then do
PutLog("Error opening "xpackcfg,10,10)
call cleanup()
Exit 1
end
i=0
DO forever
Line=Upper(strip(space(ReadLn('cfgfile'),1),'B'))
if EOF('cfgfile') then Leave
if Left(Line,1)=";" | Line="" then Iterate
i=i+1
if pos('@',Line)>0 then parse var Line fromnode.i.domain"#"fromnode.i.zone":"fromnode.i.net"/"fromnode.i.node"."fromnode.i.point" "tonode.i.domain" "archiver.i" "pri.i" "poll.i" "win.i
else parse var Line fromnode.i.domain"#"fromnode.i.zone":"fromnode.i.net"/"fromnode.i.node"."fromnode.i.point" "tonode.i.domain"#"tonode.i.zone":"tonode.i.net"/"tonode.i.node"."tonode.i.point" "archiver.i" "pri.i" "poll.i" "win.i
if left(archiver.i,3)="NON" then TONODE.I.ARCHIVER="none"
else TONODE.I.ARCHIVER=VALUE(ARCHIVER.I)
select
when left(pri.i, 3)="CRA" then TONODE.I.PRI=DTPRI_CRASH
when left(pri.i, 3)="HOL" then TONODE.I.PRI=DTPRI_HOLD
when left(pri.i, 3)="DIR" then TONODE.I.PRI=DTPRI_DIRECT
when left(pri.i, 3)="NOR" then TONODE.I.PRI=DTPRI_NORM
when datatype(pri.i)="NUM" then TONODE.I.PRI=pri.i